import react from '@vitejs/plugin-react'
import { defineConfig, loadEnv } from 'vite'
import path from 'path';
const resolve = (dir) => path.resolve(__dirname, dir);
export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      "@": resolve( './src'),
      "@pages": resolve("./src/pages"),
      "@assets": resolve("./src/assets"),
      "@styles": resolve("./src/styles"),
      "@plugins": resolve("./src/plugins"),
      "@request": resolve("./src/request"),
      "@bootstrap": resolve("./src/bootstrap"),
      "@state":resolve("./src/defineState"),
      "@store": resolve("./src/bootstrap/useStore"),
      "@components": resolve("./src/components"),
      "@dto": resolve("./src/definition/dto"),
      "@vo": resolve("./src/definition/vo"),
      "@enum": resolve("./src/definition/enum"),
    }
  },
  server:{
    // open: true,
    host: '0.0.0.0',
    // port:,
    proxy: {
      '/api': {
        target:'http://127.0.0.1:8525',
        ws:true, //socket 代理
        changeOrigin:true,
        rewrite: path => path.replace('/api', '')
      }
    }
  },
})
